Skip to content

feat: gate configurable top nav behind navigation-preview flag; de-viralize TopNav - #3869

Merged
theletterf merged 4 commits into
feature/section-island-sidebarsfrom
feature/top-nav-behind-feature-flag
Aug 14, 2026
Merged

feat: gate configurable top nav behind navigation-preview flag; de-viralize TopNav#3869
theletterf merged 4 commits into
feature/section-island-sidebarsfrom
feature/top-nav-behind-feature-flag

Conversation

@Mpdreamz

Copy link
Copy Markdown
Member

Summary

  • Feature flag gate: the new section-driven top nav now only renders when navigation-preview is enabled (dev/preview environments, or FEATURE_NAVIGATION_PREVIEW=true). Prod (navigation.yml) renders byte-for-byte as before.
  • De-viralize TopNav: removed TopNav from BuildContextHtmlWriterIndexViewModelIndex.cshtmlGlobalLayoutViewModel. It is now a derived property that walks CurrentNavigationItem.Parent up to the first ISiteNavigationRoot — implemented by SiteNavigation and computed in its constructor only when the flag is on.
  • SectionTopNavBuilder moved from Elastic.Documentation.Assembler.Navigation to Elastic.Documentation.Navigation.Assembler (beside SectionNavigation) so SiteNavigation owns TopNav without an assembler-layer dependency.
  • _SecondaryNav.cshtml branched at the container level: flag-off path restores main's exact justify-between + Docs brand link; flag-on path gets the justify-start scrollable container.
  • Sidebar pages-dropdown restored for prod: isUsingNavigationDropdown = globalNavigation.TopNav is null so the dropdown is on when there is no top nav (prod) and off when the top nav takes over.
  • initListing regression fixed: commit 1722e573f had dropped both the import and htmx:load registration; restored in main.ts.
  • Synthetics restored: #pages-dropdown step back; synthetics exercise prod-shaped builds.

Stacks on #3792 and #3867.

Closes: follow-up tracking issue filed separately — "Navigation 1st principles hardening".

Test plan

  • dotnet build — zero errors
  • dotnet test tests/Navigation.Tests/ — 224/224 passed
  • npm run test — 170/170 passed
  • npm run compile:check — clean
  • ./build.sh unit-test — 2,411 C# tests, 0 failures
  • Pre-push lint (./build.sh lint) — no violations
  • Flag-off byte-diff vs main (<nav id="secondary-nav"> block + one sidebar)
  • Flag-on smoke: --environment dev assembler build — Guides tab active on get-started page, Reference tab active on reference page

🤖 Generated with Claude Code

@Mpdreamz
Mpdreamz requested a review from a team as a code owner August 14, 2026 11:06
@Mpdreamz
Mpdreamz requested a review from technige August 14, 2026 11:06
@Mpdreamz
Mpdreamz changed the base branch from main to feature/section-island-sidebars August 14, 2026 11:08
Mpdreamz and others added 4 commits August 14, 2026 15:01
…ralize TopNav

- Move SectionTopNavBuilder to Elastic.Documentation.Navigation.Assembler so
  SiteNavigation can own TopNav without an assembler dependency
- Add ISiteNavigationRoot interface and implement it on SiteNavigation; TopNav
  is computed in the SiteNavigation ctor only when navigationPreviewEnabled=true
- Pass navigationPreviewEnabled into SiteNavigation from AssemblerBuildService;
  remove the unconditional fan-out loop that set TopNav on every BuildContext
- Remove TopNav from BuildContext, HtmlWriter, IndexViewModel, Index.cshtml;
  GlobalLayoutViewModel.TopNav is now a derived property that walks the parent
  chain to the first ISiteNavigationRoot
- _SecondaryNav.cshtml branches at the container level — flag-off path restores
  main's exact justify-between + Docs link markup, no overflow-x-auto
- GlobalNavigationHtmlWriter: isUsingNavigationDropdown = globalNavigation.TopNav is null
  so the sidebar pages-dropdown is on when the top nav is absent (prod) and off
  when it takes over (nav-preview builds)
- Restore initListing import and htmx:load registration in main.ts (regression
  from PR #3781 merge)
- Restore #pages-dropdown synthetics step; synthetics exercise prod-shaped builds
- Update SecondaryNavRenderingTests to derive TopNav via MockSiteNavigationRoot
  parent chain instead of assigning it directly on GlobalLayoutViewModel

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ag-off path

The assembler build defaults to 'dev' when no environment is matched, and 'dev'
has NAVIGATION_PREVIEW: true. The CI synthetics job runs with '-c local', which
previously fell through to 'dev', making TopNav non-null and hiding #pages-dropdown.

'local' is a temporary environment matching the CI setup (no NAVIGATION_PREVIEW)
so the flag-off secondary-nav path remains testable until NAVIGATION_PREVIEW is
retired as a flag and becomes the default.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dropdown

The pages-dropdown SVG click was timing out in CI (local environment, flag-off path).
Both flag-off (#secondary-nav built-in Reference link) and flag-on (top-nav Reference tab)
render a Reference link inside #secondary-nav, making this approach reliable in both states.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@theletterf
theletterf force-pushed the feature/top-nav-behind-feature-flag branch from 914d378 to 7d6eabc Compare August 14, 2026 13:02
@theletterf
theletterf merged commit 5bdbab4 into main Aug 14, 2026
25 checks passed
@theletterf
theletterf deleted the feature/top-nav-behind-feature-flag branch August 14, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants